<?php
require_once '../inc/config.php';/* 得到session_start */
require_once '../inc/section.php';
require_once '../inc/user.php';
require_once '../inc/book.php';
require_once '../inc/seeself.php';
require_once 'header.php';
$current_user=$_SESSION['CURRENT_USER'];
$uId=$current_user["uId"];

?>
<!DOCTYPE html>
<html>
<head>
	<meta  charset="UTF-8">
		<title><?php echo $current_user["uName"];?>的主页--阅读记</title>
		<link rel="stylesheet" href="../css/seeself.css">
		<script type="text/javascript" src="../inc/jquery-2.1.1.min.js"></script>
		<script src="../script/seeself.js"></script>
	</head>
	<body>
		<div class="main">			
		<?php 
		$mybook='我的书评 ';$myreply='我的评论';
		$li=""; 
        $li.=<<<li
        <div class="nav">
           <a href="#books" onclick="change_div('books')"><span  style="font-size:28px;color:#254729;text-align:center;">$mybook</span> </a>&nbsp; 
           <a href="#replys" onclick="change_div('replys')"><span  style="font-size:28px;color:#254729;text-align:center;">$myreply <span></a>
           </div>   
li;
  echo  $li; ?>    
       <div class="mybooks" id="books">
            <?php 
	    $review=getReview($uId);//var_dump($review);	    
	    $li="";   
	     for ($i=0;$i<count($review);$i++){      	         
	         $reviewId=$review[$i]["reviewId"];        
	         $title=$review[$i]["title"];
	         $content=$review[$i]["content"];
	         $reviewtime=$review[$i]["reviewtime"];
	         $uId=$review[$i]["uId"];
	         $user=getUserId($uId);
	         $head=$user["head"];
	         $uName=$user["uName"];	         
	         $good=$review[$i]["good"];	         
	         $labelId=$review[$i]["labelId"];
	         $labels=findRevLabel($labelId);
	         $label=$labels["label"];
             $bookId=$review[$i]["bookId"];
             $book=getBook($bookId);
             $bookName=$book[$i]["bookName"];
	         $bookPic=$book[$i]["bookPic"];
	         $li.=<<<li
	         <div class="book"><br>
	             <div class="head"><img src="../image/book/$bookPic"  width="160px" height="200px";/></div>
                 <p style="font-size:19px;float:right;">$reviewtime</p>
                 <div class="title">
                 <br><p style="font-size:25px;color:#254729;">$bookName</p><br>      
                 <p style="font-size:20px;"><a href="../style/review.php?reviewId=$reviewId" target="_Blank">标题：$title</a></p>
                 <br><p style="font-size:20px;">评语:$content</p> 
 
li;

            if($labelId!=1){
                $li.=<<<li
                 <div class="spa2">$label</div>
li;
	         }
	         
	         $li.=<<<li
                </div>
	         </div>
li;
	     }
	     echo $li;      //输出书评信息
	     ?>
		</div><!-- books -->
	<div class="myreplys" id="replys" style="display:none;">
	
				<?php  
					$reply=findreply($uId);
					$showReply="";
					for ( $i=0; $i<count($reply); $i++)
					{
					    $replyId=$reply["$i"]["replyId"];
					    $replyUId=$reply["$i"]["uId"];
					    $replyContent=$reply["$i"]["content"];
					    $replytime=$reply["$i"]["replytime"];
                        $reviewreply=findReviewfromreply($replyId);
                        $reviewId=$reviewreply[$i]["reviewId"];
                        $title=$review[$i]["title"];
                        $content=$review[$i]["content"];
					    $showReply.=<<<html
                                   <div class="reply">
                                   
                                     
                                        </div><br>
                                        <div class="replyNew">
                                              <span style="font-size:18px;color:grey;">书评标题：$title</span>
                                              <br>
                                              <span style="font-size:18px;color:grey;">书评内容：$content</span><br><br> 
                                              <span style="font-size:22px;color:#254929;">我的评论：$replyContent</span>
                                        </div><br>
                                        <div class="replyTimeDIV">
                                            <span class="replyTime">发布时间：$replytime</span>
				    
                                 <button onclick="ReplyDel('$reviewId','$replyId')">删除</button>
html;
					    
					    $showReply.=<<<html
                                       </div><br>
html;
					}
					echo $showReply;
					?>
					
	</div><!-- reply -->
	</div><!-- main -->
 
<div><?php require_once 'footer.php';?></div>
</body>
</html>
		